#ifndef EXT2_H
#define EXT2_H
#include "disk.h"
#include "head.h"

static sp_block superblock;

int ls(char* argv[], int* argc);

int mkdir(char* argv[], int* argc);

int touch(char* argv[], int* argc);

int cp(char* argv[], int* argc);

void shutdown();

int init_ext2();

void init_sp_block(sp_block* superblock);

int find_first_free_data();

int find_first_free_inode();

int parse_path(char *path, char *argv[], int *argc);
int check_block_point(int data_block_index);
int make_new_dir_by_block_index_and_name(int block_index, char *name, int type);
void init_block_by_index(int block_index);
int get_inode_id_by_inode_and_dir_name(struct inode *p, char *dir_name, int type);
struct inode* get_inode_by_path(char *argv[], int argc, int *inode_id);
void init_new_inode_by_index_and_type(int inode_id, int type);
int create_copied_dir_by_block_index_and_name(int block_index, char *name, struct inode *src);

void set_sp_block_inode(int inode_id);
void clear_sp_block_inode(int inode_id);
void set_sp_block_data(int data_index);
void clear_sp_block_data(int data_index);
#endif